﻿using Microsoft.AspNetCore.Mvc;
using Web.Middlewares;

namespace Web.Controllers
{
    [ApiController]
    [Route("api/[controller]/[action]")]
    public class MenuController : ControllerBase
    {
        public IMenuService _menuService { get; set; }
        public MenuController(IMenuService menuService)
        {
            _menuService = menuService;
        }
        [HttpGet, AnonymousRole]
        public async Task<List<RouteInfo>> GetMenuByRoleId()
        {
            return await _menuService.GetMenuListByRoleKey();
        }
        [HttpGet]
        public async Task<IEnumerable<SysMenu>> GetAll()
        {
            return await Task.FromResult(_menuService.GetAllMenu());
        }
    }
}